package com.doit.day01;

import org.apache.zookeeper.CreateMode;
import org.apache.zookeeper.ZooDefs;
import org.apache.zookeeper.ZooKeeper;

import java.nio.charset.StandardCharsets;

//zookeeper是啥  能够干啥   集群的感知
public class GetNodeDemo {
    public static void main(String[] args) throws Exception {
        /**
         * 连接字符串：host：port
         * 超时时间：
         */
        //创建连接对象
        ZooKeeper zooKeeper = new ZooKeeper("linux01:2181,linux02:2181,linux03:2181",2000,null);

        byte[] data = zooKeeper.getData("/doit", null, null);
        System.out.println(new String(data));
        //关闭资源
        zooKeeper.close();
        //监控
    }
}
